<?php
/*
    My College Link Database Functions
    Dan Newman
    studentDB.php
    7/3/2011
	
	requires DBFunctions.php
 */

//set javascript variables for use in bio page
$sMsg = 'not set';
$sportList = array();
if(isset($_GET['uid'])){
	$res = getSports($_GET['uid']);
	$sMsg = count($res);
	foreach ($res as $r ){
		extract($r);
		$sportList[] = $sport;
	}
}

echo "<script type='text/javascript'> var sportMsg= '$sMsg'; var sports = '$sportList[1]';</script>";

//returns 2 strings for first and last name
function getSports($userID){
  $query = <<<STR
	Select S.SportName As sport
	From Sport S, Athletic_Sport A
	Where S.SportID = A.SportID AND A.AthleticID IN 
		(Select U.AthleticID
		From Users U
		Where UserID = '$userID');
STR;
  
  return executeQuery($query);
}

?>